<script lang="ts" setup>
import axios from 'axios';
import { onMounted, ref } from 'vue';
import { useRoute } from 'vue-router';

interface BookDetails{
    id:string,
    name:string,
    type:string
}

let route = useRoute();
let deatilsData =ref<BookDetails|null>(null)
onMounted(async()=>{
    
    let res = await axios.get("http://localhost:8080/api/books/"+route.query.id)
    deatilsData.value = res.data
})
</script>

<template>  
<h1>书籍详情</h1>
<div v-if="deatilsData">
    <h2>序号:{{ deatilsData.id }}</h2>
    <h2>书名:{{ deatilsData.name }}</h2>
    <h2>类型:{{ deatilsData.type }}</h2>
</div>

</template>

<style>
</style>